

public class TestPerson {
    public static void main(String[] args) {
        System.out.println("人数:"+Person.getTotalPerson());
        Person person1=new Person();
        System.out.println("人数:"+Person.getTotalPerson());
    }
}

class Person{
    private static int id;
    private static int total=0;
    public static int getTotalPerson(){
        id++;
        return total;
    }
    public Person(){
        total++;
        id=total;
    }
}
